<template>
  <div class="admin-layout" :class="{ 'light-theme': themeStore.isLight }">
    <el-container style="height: 100vh">
      <!-- 侧边菜单 -->
      <el-aside width="220px" class="aside">
        <div class="logo-container">
          <el-icon class="logo-icon"><Camera /></el-icon>
          <h2 class="logo">摄影管理后台</h2>
        </div>
        <el-menu
          router
          :default-active="activeMenu"
          class="el-menu-vertical"
          :background-color="themeStore.isLight ? '#ffffff' : 'transparent'"
          :text-color="themeStore.isLight ? '#2D3748' : '#bfcbd9'"
          :active-text-color="themeStore.isLight ? '#4299E1' : '#9B4DCA'"
        >
          <el-menu-item index="/admin/dashboard">
            <el-icon><Odometer /></el-icon>
            <template #title>仪表盘</template>
          </el-menu-item>
          <el-menu-item index="/admin/posts">
            <el-icon><Document /></el-icon>
            <template #title>帖子管理</template>
          </el-menu-item>
          <el-menu-item index="/admin/photos">
            <el-icon><PictureFilled /></el-icon>
            <template #title>图片管理</template>
          </el-menu-item>
          <el-menu-item index="/admin/comments">
            <el-icon><ChatDotRound /></el-icon>
            <template #title>评论管理</template>
          </el-menu-item>
          <el-menu-item index="/admin/users">
            <el-icon><User /></el-icon>
            <template #title>用户管理</template>
          </el-menu-item>
          <!-- <el-menu-item index="/admin/blacklist">
            <el-icon><RemoveFilled /></el-icon>
            <template #title>已封禁用户</template>
          </el-menu-item> -->
          <!-- <el-menu-item index="/admin/review">
            <el-icon><Checked /></el-icon>
            <template #title>内容审核</template>
          </el-menu-item> -->
        </el-menu>
      </el-aside>
      
      <!-- 内容区域 -->
      <el-container>
        <!-- 顶部导航 -->
        <el-header class="header">
          <div class="header-left">
            <el-icon class="fold-icon" @click="toggleCollapse"><Fold /></el-icon>
            <el-breadcrumb separator="/">
              <el-breadcrumb-item :to="{ path: '/admin/dashboard' }">首页</el-breadcrumb-item>
              <el-breadcrumb-item>{{ currentPageTitle }}</el-breadcrumb-item>
            </el-breadcrumb>
          </div>
          <div class="header-right">
            <!-- 主题切换按钮 -->
            <el-tooltip
              :content="themeStore.isLight ? '切换到暗色主题' : '切换到亮色主题'"
              placement="bottom"
            >
              <el-button
                class="theme-switch"
                circle
                @click="toggleTheme"
              >
                <el-icon>
                  <component :is="themeStore.isLight ? Moon : Sunny" />
                </el-icon>
              </el-button>
            </el-tooltip>
            <el-dropdown @command="handleCommand">
              <span class="user-dropdown" style="border: none; outline: none; box-shadow: none;">
                <el-avatar size="small" :src="adminInfo.avatar || 'https://randomuser.me/api/portraits/men/32.jpg'" />
                <span class="user-name">{{ adminInfo.username || '管理员' }}</span>
                <el-icon><ArrowDown /></el-icon>
              </span>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item command="info">个人信息</el-dropdown-item>
                  <!-- <el-dropdown-item command="changePassword">修改密码</el-dropdown-item> -->
                  <el-dropdown-item divided command="logout">退出登录</el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </el-header>
        
        <!-- 主要内容区域 -->
        <el-main class="main-content">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
    <el-dialog v-model="changePwdDialogVisible" title="修改密码" width="400px">
      <el-form :model="pwdForm" ref="pwdFormRef" label-width="100px" :rules="pwdRules">
        <el-form-item label="原密码" prop="old_password">
          <el-input 
            v-model="pwdForm.old_password" 
            :type="showPasswords.old_password ? 'text' : 'password'" 
            autocomplete="off" 
            placeholder="请输入原密码"
          >
            <template #suffix>
              <el-icon 
                class="password-eye" 
                @click="showPasswords.old_password = !showPasswords.old_password"
              >
                <svg v-if="showPasswords.old_password" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
                  <circle cx="12" cy="12" r="3" />
                </svg>
                <svg v-else viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" />
                  <line x1="1" y1="1" x2="23" y2="23" />
                </svg>
              </el-icon>
            </template>
          </el-input>
        </el-form-item>
        <el-form-item label="确认原密码" prop="confirm_old_password">
          <el-input 
            v-model="pwdForm.confirm_old_password" 
            :type="showPasswords.confirm_old_password ? 'text' : 'password'" 
            autocomplete="off" 
            placeholder="请再次输入原密码"
          >
            <template #suffix>
              <el-icon 
                class="password-eye" 
                @click="showPasswords.confirm_old_password = !showPasswords.confirm_old_password"
              >
                <svg v-if="showPasswords.confirm_old_password" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
                  <circle cx="12" cy="12" r="3" />
                </svg>
                <svg v-else viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" />
                  <line x1="1" y1="1" x2="23" y2="23" />
                </svg>
              </el-icon>
            </template>
          </el-input>
        </el-form-item>
        <el-form-item label="新密码" prop="new_password">
          <el-input 
            v-model="pwdForm.new_password" 
            :type="showPasswords.new_password ? 'text' : 'password'" 
            autocomplete="off" 
            placeholder="请输入新密码"
          >
            <template #suffix>
              <el-icon 
                class="password-eye" 
                @click="showPasswords.new_password = !showPasswords.new_password"
              >
                <svg v-if="showPasswords.new_password" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
                  <circle cx="12" cy="12" r="3" />
                </svg>
                <svg v-else viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" />
                  <line x1="1" y1="1" x2="23" y2="23" />
                </svg>
              </el-icon>
            </template>
          </el-input>
        </el-form-item>
        <el-form-item label="确认新密码" prop="confirm_new_password">
          <el-input 
            v-model="pwdForm.confirm_new_password" 
            :type="showPasswords.confirm_new_password ? 'text' : 'password'" 
            autocomplete="off" 
            placeholder="请再次输入新密码"
          >
            <template #suffix>
              <el-icon 
                class="password-eye" 
                @click="showPasswords.confirm_new_password = !showPasswords.confirm_new_password"
              >
                <svg v-if="showPasswords.confirm_new_password" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
                  <circle cx="12" cy="12" r="3" />
                </svg>
                <svg v-else viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
                  <path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" />
                  <line x1="1" y1="1" x2="23" y2="23" />
                </svg>
              </el-icon>
            </template>
          </el-input>
        </el-form-item>
      </el-form>
      <template #footer>
        <el-button @click="changePwdDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="submitChangePwd">确定</el-button>
      </template>
    </el-dialog>
    <el-dialog 
      v-model="profileDialogVisible" 
      title="个人信息" 
      width="500px" 
      :show-close="true"
      class="profile-dialog"
      align-center
    >
      <el-form :model="profileInfo" ref="profileFormRef" label-width="100px">
        <div class="dialog-avatar-container">
          <el-upload
            class="avatar-uploader"
            action="/your-upload-api"  
            :show-file-list="false"
            :on-success="handleAvatarSuccess"
            :before-upload="beforeAvatarUpload"
          >
            <div class="avatar-wrapper">
              <el-avatar :size="100" :src="profileInfo.avatar" />
              <div class="avatar-edit-overlay">
                <el-icon><Edit /></el-icon>
              </div>
            </div>
          </el-upload>
          <div class="avatar-tip">点击头像更换</div>
        </div>
        
        <el-form-item label="管理员名称">
          <el-input v-model="profileInfo.username" placeholder="请输入名称" />
        </el-form-item>
        
        <el-form-item label="性别">
          <el-radio-group v-model="profileInfo.gender">
            <el-radio :label="0">男</el-radio>
            <el-radio :label="1">女</el-radio>
            <el-radio :label="2">保密</el-radio>
          </el-radio-group>
        </el-form-item>
        
        <el-form-item label="电子邮箱">
          <el-input v-model="profileInfo.email" placeholder="请输入电子邮箱" />
        </el-form-item>
        
        <el-form-item label="手机号码">
          <el-input v-model="profileInfo.phone" placeholder="请输入手机号码" />
        </el-form-item>
        
        <el-form-item label="注册时间">
          <el-input v-model="profileInfo.register_time" disabled />
        </el-form-item>
      </el-form>
      
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="profileDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitProfile">保存</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, computed, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { ElMessageBox, ElMessage } from 'element-plus'
import { 
  Camera, Odometer, PictureFilled, ChatDotRound, User, 
  /*RemoveFilled, Checked,*/ Fold, ArrowDown, Moon, Sunny, Document,
  Edit
} from '@element-plus/icons-vue'
import { useThemeStore } from '@/stores/theme'
import request from '@/utils/request'
import { getAdminInfo } from '@/api'

const themeStore = useThemeStore()

const route = useRoute()
const router = useRouter()
const isCollapse = ref(false)

// 管理员信息
const adminInfo = ref({
  avatar: '',
  username: '',
})

// 页面加载时获取管理员信息
const fetchAdminInfo = async () => {
  try {
    const res = await getAdminInfo()
    adminInfo.value.avatar = res.data.data.avatar
    adminInfo.value.username = res.data.data.username
  } catch (e) {
    adminInfo.value.avatar = ''
    adminInfo.value.username = '管理员'
  }
}
onMounted(() => {
  fetchAdminInfo()
})

// 当前菜单激活项
const activeMenu = computed(() => route.path)

// 当前页面标题
const currentPageTitle = computed(() => {
  switch (route.path) {
    case '/admin/dashboard':
      return '仪表盘'
    case '/admin/posts':
      return '帖子管理'
    case '/admin/photos':
      return '图片管理'
    case '/admin/comments':
      return '评论管理'
    case '/admin/users':
      return '用户管理'
    case '/admin/profile':
      return '个人信息'
    case '/admin/info':
      return '管理员信息'
    // case '/admin/blacklist':
    //   return '已封禁用户'
    // case '/admin/review':
    //   return '内容审核'
    default:
      return '仪表盘'
  }
})

// 折叠侧边栏
const toggleCollapse = () => {
  isCollapse.value = !isCollapse.value
}

// 切换主题
const toggleTheme = () => {
  themeStore.toggleTheme()
}

// 修改密码相关
const changePwdDialogVisible = ref(false)
const pwdForm = ref({
  old_password: '',
  confirm_old_password: '',
  new_password: '',
  confirm_new_password: ''
})
const pwdFormRef = ref(null)
// 显示密码控制
const showPasswords = ref({
  old_password: false,
  confirm_old_password: false,
  new_password: false,
  confirm_new_password: false
})

// 自定义验证函数 - 验证确认原密码
const validateConfirmOldPassword = (rule, value, callback) => {
  if (value === '') {
    callback(new Error('请再次输入原密码'))
  } else if (value !== pwdForm.value.old_password) {
    callback(new Error('两次输入的原密码不一致'))
  } else {
    callback()
  }
}

// 自定义验证函数 - 验证确认新密码
const validateConfirmNewPassword = (rule, value, callback) => {
  if (value === '') {
    callback(new Error('请再次输入新密码'))
  } else if (value !== pwdForm.value.new_password) {
    callback(new Error('两次输入的新密码不一致'))
  } else {
    callback()
  }
}

// 自定义验证函数 - 验证新密码
const validateNewPassword = (rule, value, callback) => {
  if (value === '') {
    callback(new Error('请输入新密码'))
  } else if (value.length < 6) {
    callback(new Error('密码长度不能少于6位'))
  } else if (value === pwdForm.value.old_password) {
    callback(new Error('新密码不能与原密码相同'))
  } else {
    // 如果确认密码已经输入，则再次验证确认密码
    if (pwdForm.value.confirm_new_password !== '') {
      // 触发确认密码的验证
      pwdFormRef.value.validateField('confirm_new_password')
    }
    callback()
  }
}

const pwdRules = {
  old_password: [
    { required: true, message: '请输入原密码', trigger: 'blur' }
  ],
  confirm_old_password: [
    { required: true, message: '请再次输入原密码', trigger: 'blur' },
    { validator: validateConfirmOldPassword, trigger: 'blur' }
  ],
  new_password: [
    { required: true, message: '请输入新密码', trigger: 'blur' },
    { min: 6, message: '密码长度不能少于6位', trigger: 'blur' },
    { validator: validateNewPassword, trigger: 'blur' }
  ],
  confirm_new_password: [
    { required: true, message: '请再次输入新密码', trigger: 'blur' },
    { validator: validateConfirmNewPassword, trigger: 'blur' }
  ]
}

// 个人信息相关
const profileDialogVisible = ref(false)
const profileInfo = ref({
  avatar: 'https://randomuser.me/api/portraits/men/32.jpg',
  username: '管理员',
  gender: 0,
  register_time: '2023-01-01 12:00:00',
  email: 'admin@example.com',
  phone: '13800138000'
})
const profileFormRef = ref(null)

// 头像上传前的校验
const beforeAvatarUpload = (file) => {
  const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
  const isLt2M = file.size / 1024 / 1024 < 2

  if (!isJpgOrPng) {
    ElMessage.error('头像图片只能是JPG或PNG格式!')
  }
  
  if (!isLt2M) {
    ElMessage.error('头像图片大小不能超过2MB!')
  }
  
  return isJpgOrPng && isLt2M
}

// 头像上传成功回调
const handleAvatarSuccess = (response) => {
  // 假设后端返回 { data: { url: 'xxx' } }
  // profileInfo.value.avatar = response.data.url
  
  // 模拟更新头像
  if (response.raw) {
    profileInfo.value.avatar = URL.createObjectURL(response.raw)
  } else if (response.data && response.data.url) {
    profileInfo.value.avatar = response.data.url
  }
  ElMessage.success('头像更新成功')
}

const submitProfile = async () => {
  try {
    // 这里调用你的保存接口
    // await request.post('/admin/profile/update', profileInfo.value)
    ElMessage.success('个人信息保存成功')
    profileDialogVisible.value = false
  } catch (error) {
    ElMessage.error('保存失败：' + (error.message || '未知错误'))
  }
}

const submitChangePwd = () => {
  pwdFormRef.value.validate(async (valid) => {
    if (!valid) return
    
    // 额外检查：确保新密码与原密码不同
    if (pwdForm.value.new_password === pwdForm.value.old_password) {
      ElMessage.error('新密码不能与原密码相同')
      return
    }

    try {
      await request.post('/admin/change-password', {
        old_password: pwdForm.value.old_password,
        new_password: pwdForm.value.new_password
      })
      ElMessage.success('密码修改成功，请重新登录')
      changePwdDialogVisible.value = false
      // 强制退出登录
      await request.post('/admin/logout')
      localStorage.removeItem('adminToken')
      router.push('/admin/login')
    } catch (error) {
      ElMessage.error(error?.response?.data?.msg || '密码修改失败')
    }
  })
}

const handleCommand = async (command) => {
  if (command === 'logout') {
    try {
      await ElMessageBox.confirm('确定要退出登录吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
      await request.post('/admin/logout')
      localStorage.removeItem('adminToken')
      ElMessage.success('退出登录成功')
      router.push('/admin/login')
    } catch (error) {
      if (error !== 'cancel') {
        console.error('退出登录失败:', error)
      }
    }
    return
  }
  if (command === 'changePassword') {
    changePwdDialogVisible.value = true
    pwdForm.value.old_password = ''
    pwdForm.value.confirm_old_password = ''
    pwdForm.value.new_password = ''
    pwdForm.value.confirm_new_password = ''
    // 重置所有显示密码状态为隐藏
    showPasswords.value = {
      old_password: false,
      confirm_old_password: false,
      new_password: false,
      confirm_new_password: false
    }
    return
  }
  if (command === 'info') {
    // 导航到个人信息页面
    router.push('/admin/info')
    return
  }
}
</script>

<style>
/* 全局样式覆盖，移除Element Plus的dropdown边框 */
.el-dropdown {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.el-dropdown .el-dropdown-link {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.el-dropdown-menu {
  border: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}
</style>

<style scoped>
.admin-layout {
  height: 100%;
}

/* 主题切换按钮样式 */
.theme-switch {
  margin-right: 8px;
  background: transparent;
  border: none;
  color: #ffffff;
}

/* 密码显示/隐藏按钮样式 */
.password-eye {
  cursor: pointer;
  color: #909399;
  transition: all 0.3s;
}

.password-eye:hover {
  color: #409EFF;
}

.theme-switch:hover {
  background: rgba(155,77,202,0.2);
  border-color: rgba(155,77,202,0.3);
  color: #ffffff;
  transform: scale(1.05);
}

.theme-switch .el-icon {
  font-size: 1.2rem;
}

/* 亮色主题下的按钮样式 */
.light-theme .theme-switch {
  background: rgba(66,153,225,0.1);
  border: 1px solid rgba(66,153,225,0.2);
  color: #4299E1;
}

.light-theme .theme-switch:hover {
  background: rgba(66,153,225,0.2);
  border-color: rgba(66,153,225,0.3);
  color: #2D3748;
}

/* 亮色主题样式 */
.light-theme {
  --bg-gradient-start: #f7fafc;
  --bg-gradient-end: #edf2f7;
  --card-bg: #ffffff;
  --text-primary: #2D3748;
  --text-secondary: #4A5568;
  --border-color: #e2e8f0;
}

.light-theme .aside {
  background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  box-shadow: 2px 0 16px 0 rgba(0,0,0,0.06);
}

.light-theme .logo-container {
  background: var(--card-bg);
}

.light-theme .logo {
  color: var(--text-primary);
}

.light-theme .header {
  background: linear-gradient(90deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.light-theme .main-content {
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  color: var(--text-primary);
}

.light-theme .user-dropdown,
.light-theme .user-name {
  color: var(--text-primary);
}

/* 侧边菜单样式 */
.aside {
  background: linear-gradient(180deg, #2B2F3A 0%, #363B48 100%);
  overflow-x: hidden;
  box-shadow: 2px 0 16px 0 rgba(0,0,0,0.12);
}
.logo-container {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: rgba(43, 47, 58, 0.95);
  padding-left: 24px;
  gap: 10px;
}
.logo-icon {
  font-size: 28px;
  color: #8A2BE2;
}
.logo {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 1px;
}
.el-menu-vertical {
  border-right: none;
  background: transparent;
  margin-top: 10px;
}
.el-menu-vertical .el-menu-item {
  border-radius: 8px;
  margin: 6px 12px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.el-menu-vertical .el-menu-item.is-active {
  background: linear-gradient(90deg, #9B4DCA 60%, #4299E1 100%);
  color: #fff !important;
  box-shadow: 0 2px 8px 0 rgba(155,77,202,0.12);
}
.el-menu-vertical .el-menu-item:hover {
  background: rgba(155,77,202,0.12);
  color: #9B4DCA;
}

/* 顶部导航栏样式 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: linear-gradient(90deg, #2B2F3A 0%, #363B48 100%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  height: 64px;
  color: #ffffff;
  box-shadow: 0 2px 8px 0 rgba(0,0,0,0.12);
}
.header-left {
  display: flex;
  align-items: center;
}
.fold-icon {
  font-size: 1.25rem;
  margin-right: 18px;
  cursor: pointer;
  color: #9B4DCA;
  transition: color 0.2s;
}
.fold-icon:hover {
  color: #4299E1;
}
.user-dropdown {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  color: #ffffff;
  gap: 8px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.15);
  border: none !important;
  background: transparent !important;
  padding: 4px 8px;
  border-radius: 4px;
}
.user-name {
  margin: 0 4px 0 6px;
  font-weight: 500;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* 主内容区域样式 */
.main-content {
  background: linear-gradient(135deg, #2B2F3A 0%, #363B48 100%);
  padding: 32px 24px;
  min-height: calc(100vh - 64px);
  overflow-y: auto;
  border-radius: 0 0 18px 18px;
  color: #e0e0e0;
}

/* 面包屑样式 */
:deep(.el-breadcrumb__item) {
  color: #a0aec0;
  font-size: 0.95rem;
}

:deep(.el-breadcrumb__item.is-link) {
  color: #4299E1;
  font-weight: 500;
}

:deep(.el-breadcrumb__item.is-link:hover) {
  color: #3182CE;
}

:deep(.el-breadcrumb__separator) {
  color: #a0aec0;
  margin: 0 8px;
}

/* 去除下拉菜单的黑色边框 */
:deep(.el-dropdown-menu) {
  border: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* 美化用户下拉菜单项 */
:deep(.el-dropdown-menu__item) {
  padding: 10px 20px;
  font-size: 14px;
}

:deep(.el-dropdown-menu__item:hover) {
  background-color: #f5f7fa;
}

:deep(.el-dropdown-menu__item.is-divided) {
  border-top-color: #ebeef5;
}

.admin-layout:not(.light-theme) :deep(.el-breadcrumb__item .el-breadcrumb__inner),
.admin-layout:not(.light-theme) :deep(.el-breadcrumb__item .el-breadcrumb__inner.is-link),
.admin-layout:not(.light-theme) :deep(.el-breadcrumb__item a),
.admin-layout:not(.light-theme) :deep(.el-breadcrumb__item a.is-link),
.admin-layout:not(.light-theme) :deep(.el-breadcrumb__item [style^="color"]) {
  color: #fff !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 8px rgba(0,0,0,0.28) !important;
  opacity: 1 !important;
  filter: none !important;
}

.avatar-uploader .avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
}
.avatar-uploader-icon {
  font-size: 32px;
  color: #8c939d;
  width: 80px;
  height: 80px;
  line-height: 80px;
  text-align: center;
  border: 1px dashed #d9d9d9;
  border-radius: 50%;
  cursor: pointer;
}

/* 个人信息对话框相关样式 */
.profile-dialog {
  --dialog-border-radius: 8px;
}

.dialog-avatar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.avatar-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 10px;
}

.avatar-edit-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.avatar-wrapper:hover .avatar-edit-overlay {
  opacity: 1;
}

.avatar-tip {
  font-size: 12px;
  color: #909399;
  margin-top: 8px;
}

/* 调整表单内间距 */
.profile-dialog :deep(.el-form-item) {
  margin-bottom: 18px;
}

.profile-dialog :deep(.el-input__inner) {
  height: 40px;
  line-height: 40px;
}

.dialog-footer {
  text-align: right;
  padding-top: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

:deep(.el-dropdown) {
  border: none !important;
}

/* 确保dropdown触发元素没有边框和背景 */
:deep(.el-popper) {
  border: none !important;
  background: white !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* 完全移除dropdown按钮的边框和背景 */
.header-right :deep(.el-dropdown-selfdefine) {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}
</style> 